package com.zzzzzz.oms.vehicleType;

import java.util.Date;
import java.util.List;
import javax.annotation.Resource;
import javax.validation.ConstraintViolationException;
import javax.validation.Validator;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.zzzzzz.core.datagrid.BaseData;
import com.zzzzzz.plugins.shiro.I;
import com.zzzzzz.utils.BeanValidators;
import com.zzzzzz.utils.DateTimeUtils;

@Service
public class VehicleTypeService {
	
	@Resource
	public VehicleTypeDao vehicleTypeDao;
	
	@Resource
	public Validator validator;
	
	// 增加、修改
	@Transactional
	public int save(VehicleType vehicleType, I i) {
		vehicleType.setUpdDt(new Date());
		vehicleType.setUpdBy(i.getId());
		vehicleType.setPlatformId(i.getPlatformId());
		if (vehicleType.getId() == null) {
			vehicleType.setAddDt(new Date());
			vehicleType.setAddBy(i.getId());
			vehicleTypeDao.add(vehicleType);
		} else {
			vehicleTypeDao.updById(vehicleType);
		}

		return 1;
	}
	
	private static final Logger logger = LoggerFactory.getLogger(VehicleType.class);
}
